package test00;

import entity.Student;

import java.lang.reflect.Constructor;

/**
 * @Author lzp
 * @Date 2024-03-26
 */
public class test01 {
    public static void main(String[] args) throws Exception {

        Class<?> clazz = Student.class;

        Constructor<?> constructor = clazz.getConstructor(String.class,int.class,double.class);

        Object obj = constructor.newInstance("张三", 18, 180d);

        //System.out.println(obj);

        if (obj instanceof Student){
            Student stu = (Student) obj;
            stu.show();
        }
    }
}
